package game;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.KeyEvent;

public class Credits extends Scene 
{
		Background background1;
		Background background2;
		boolean background1Select = true;
		
		boolean escPress = true;
		boolean spacePress = true;
		
		public Credits()
		{
			background1 = new Background(22);
			background2 = new Background(32);
		}

		public void update()
		{
			if(Keyboard.getInstance().isKeyPressed(KeyEvent.VK_ESCAPE))
			{
				if(escPress == false)
				{
					SceneManager.changeScene(0);
					escPress = true;
				}
			}
			else
				escPress = false;
			
			
			if(Keyboard.getInstance().isKeyPressed(KeyEvent.VK_SPACE))
			{
				if(spacePress == false)
				{
					this.background1Select = !this.background1Select;
					spacePress = true;
				}
			}
			else
				spacePress = false;
		}

		@Override
		public void draw(Graphics2D g2d) 
		{
			if(this.background1Select)
				background1.draw(g2d);
			else
				background2.draw(g2d);
			
			Point sizeOpcao = new Point(100, 38);
			//opcao back menu
			g2d.drawImage(LoadImages.getImage(45),
					0,
					Game.screenHeigth - (int)sizeOpcao.getY(), null);
			
			//opcao next level
			g2d.drawImage(LoadImages.getImage(46),
					Game.screenWidth - (int)sizeOpcao.getX(),
					Game.screenHeigth - (int)sizeOpcao.getY(), null);
		}
	}
